﻿SELECT * from Arbalest.cia.RankOrderFile;


CREATE TABLE cia.FactBook_RankOrder
(
    FieldNumber INT,
    FieldDescription NVARCHAR(128),
    FileName NVARCHAR(128),
    DelimitedFieldCount TINYINT DEFAULT 0
    PRIMARY KEY (FieldNumber)
);

SELECT * FROM cia.FactBook_RankOrder;

-- INSERT INTO cia.FactBook_RankOrder (FieldNumber, FieldDescription) VALUES ('xxNum', 'xxDesc');
-- UPDATE cia.FactBook_RankOrder SET FileName = 'rawdata_' + CONVERT(VARCHAR, FieldNumber) + '.txt'

DROP TABLE cia.FactBook_RankOrderDetail
CREATE TABLE cia.FactBook_RankOrderDetail
(
    Year SMALLINT,
    FieldNumber INT, 
    Ranking SMALLINT, 
    CountryName VARCHAR(128),
    DataValue DECIMAL(28, 6)
);


INSERT cia.FactBook_RankOrderDetail (Year, FieldNumber, Ranking, CountryName, DataValue) VALUES ('2012', 'FieldNumber', 'Ranking', 'CountryName', 'DataValue');

--sp_help [cia.FactBook_RankOrderDetail]

use Arbalest

--DELETE FROM cia.FactBook_RankOrderDetail
SELECT * FROM cia.FactBook_RankOrderDetail